package com.lingyu.jsjx.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lingyu.jsjx.domain.UserDocument;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.datascope.annotation.DataScope;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.lingyu.jsjx.mapper.DocumentRecommendMapper;
import com.lingyu.jsjx.domain.DocumentRecommend;
import com.lingyu.jsjx.service.IDocumentRecommendService;

/**
 * 推荐Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-07-31
 */
@Service
public class DocumentRecommendServiceImpl extends ServiceImpl<DocumentRecommendMapper, DocumentRecommend> implements IDocumentRecommendService
{
    @Autowired
    private DocumentRecommendMapper documentRecommendMapper;

    /**
     * 查询推荐
     * 
     * @param recommendId 推荐主键
     * @return 推荐
     */
    @Override
    public DocumentRecommend selectDocumentRecommendByRecommendId(Long recommendId)
    {
        return documentRecommendMapper.selectDocumentRecommendByRecommendId(recommendId);
    }

    /**
     * 查询推荐列表
     * @return 推荐
     */
    @Override
    @DataScope(deptAlias = "u", userAlias = "dr",type = "jsjx")
    public List<DocumentRecommend> selectDocumentRecommendList(UserDocument userDocument)
    {
        return documentRecommendMapper.selectDocumentRecommendList(userDocument);
    }

    /**
     * 新增推荐
     * 
     * @param documentRecommend 推荐
     * @return 结果
     */
    @Override
    public int insertDocumentRecommend(DocumentRecommend documentRecommend)
    {
        documentRecommend.setCreateTime(DateUtils.getNowDate());
        return documentRecommendMapper.insertDocumentRecommend(documentRecommend);
    }

    /**
     * 修改推荐
     * 
     * @param documentRecommend 推荐
     * @return 结果
     */
    @Override
    public int updateDocumentRecommend(DocumentRecommend documentRecommend)
    {
        documentRecommend.setUpdateTime(DateUtils.getNowDate());
        return documentRecommendMapper.updateDocumentRecommend(documentRecommend);
    }

    /**
     * 批量删除推荐
     * 
     * @param recommendIds 需要删除的推荐主键
     * @return 结果
     */
    @Override
    public int deleteDocumentRecommendByRecommendIds(Long[] recommendIds)
    {
        return documentRecommendMapper.deleteDocumentRecommendByRecommendIds(recommendIds);
    }

    /**
     * 删除推荐信息
     * 
     * @param recommendId 推荐主键
     * @return 结果
     */
    @Override
    public int deleteDocumentRecommendByRecommendId(Long recommendId)
    {
        return documentRecommendMapper.deleteDocumentRecommendByRecommendId(recommendId);
    }
}
